package com.example.jqying.androiddemo.strategy;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

import com.example.jqying.androiddemo.R;
import com.example.jqying.androiddemo.strategy.concreteStrategy.GoldVip;
import com.example.jqying.androiddemo.strategy.concreteStrategy.NormalVip;
import com.example.jqying.androiddemo.strategy.concreteStrategy.Orgnc;
import com.example.jqying.androiddemo.strategy.concreteStrategy.SuperVip;
import com.example.jqying.androiddemo.strategy.context.Context;

public class StrategyActivity extends AppCompatActivity {

    private Context normalVip ,superVip,goldVip,orgnic;
    private TextView tv_original,tv_normal,tv_super,tv_gold,tv_orgnic;
    private double OriginalPrice = 100;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_strategy);

        orgnic =new Context(new Orgnc());
        normalVip = new Context(new NormalVip());
        superVip = new Context(new SuperVip());
        goldVip = new Context(new GoldVip());

        tv_gold = (TextView) findViewById(R.id.tv_goldVIP);
        tv_normal =(TextView) findViewById(R.id.tv_vip);
        tv_original = (TextView) findViewById(R.id.tv_original);
        tv_super = (TextView) findViewById(R.id.tv_superVIP);
        tv_orgnic = (TextView) findViewById(R.id.tv_orgnic);

        tv_original.setText("原价："+ OriginalPrice);
        tv_orgnic.setText("普通用户："+ orgnic.price(OriginalPrice));
        tv_normal.setText("普通会员："+normalVip.price(OriginalPrice));
        tv_super.setText("超级会员："+ superVip.price(OriginalPrice));
        tv_gold.setText("黄金会员："+ goldVip.price(OriginalPrice));






    }
}
